#include <stdio.h>
#include "SqList.h"

int main(int argc, char** argv) {
	SqList *L;
	InitList(L);
    char a[8]={'2','0','0','5','2','0','6','2'};
    CreateList(L,a,8);
//	L1->length=33;
//	printf("%d\n",L->length);
    DispList(L);
    ElemType e;
    int choice;
    int position;
    
    while(choice !=4)
    {
    	printf("\n\n========\n");
    	printf("1.插入数据\n"); 
    	printf("2.删除数据\n"); 
    	printf("3.查看数据\n"); 
    	printf("4.退出\n"); 
    	printf("=======请选择:");
		scanf("%d",&choice); 
    
     	switch(choice)
		{
	 		case 1: 
				printf("\n\n=====请输入要插入的位置：");
				scanf("%d",&position);
				printf("======请输入要插入的数据元素：");
				scanf("%s",&e);
				if(ListInsert(L,position,e)){	
					printf("插入后的数据是：\n");
					DispList(L);
				}else{
					printf("输入位置出错，请重新选择！");
				} 
		 		break;
			case 2:
				printf("\n\n=====请输入要删除的位置："); 
				scanf("%d",&position);
				if(ListDelete(L,position,e)){
					printf("======删除的数据是：\n"); 
					printf("%d",e);
					printf("\n删除后的数据是：\n"); 
					DispList(L);
		 	    }else{
		 	    	printf("输入位置出错，请重新选择！");
				} 
			 	break;
			case 3:
				printf("\n\n=======当前线性表为;\n"); 
				DispList(L);
				break;
			case 4:
				DestroyList(L); 
				break;
			default:
				printf("输入出错，请重新输入！");
				break; 
	 	} 
	} 
    
	
	
//	SqList L2;
//	L2.length=2;
//	printf("%d",L2.length);
	
	
	return 0;
}
